(function () {
    util = {
        decryptByDES: function (ciphertext, key) {
            var keyHex = CryptoJS.enc.Utf8.parse(key);
            // direct decrypt ciphertext
            var decrypted = CryptoJS.DES.decrypt({
                ciphertext: CryptoJS.enc.Base64.parse(ciphertext)
            }, keyHex, {
                mode: CryptoJS.mode.ECB,
                padding: CryptoJS.pad.Pkcs7
            });
            return decrypted.toString(CryptoJS.enc.Utf8);
        },
        ajaxPreDecrypt: function (resultObj) {
            if (!resultObj || resultObj.constructor == Object) {
                return resultObj;
            }
            var result = decodeURIComponent(resultObj);
            var key = result.substring(0, 12);
            key = window.atob(key);
            var ciphertext = result.substring(12);
            // ciphertext = window.atob(ciphertext);
            result = util.decryptByDES(ciphertext, key);
            return JSON.parse(result);
        }
    };
}.bind(window))()